{% extends "../../../layui/layouts/main.html" %}

{% block mainbody %}

<div id="menu-index">

    <script type="text/html" id="tool">
        <a class="layui-btn layui-btn-info layui-btn-xs" lay-event="detail">查看</a>
    </script>

    {% include "_search.tpl" %}

    <div class="layui-card">
        <div class="layui-card-header yak-card-header">
            {{Header}}
        </div>
        <div class="layui-card-body">
            <table id="drug-table" lay-filter="drug-table-filter"></table>
        </div>
    </div>

</div>

{% endblock %}

{% block script %}
<script>
    layui.use(['grid'], function () {
        var pager = layui.grid
            , tableId = "drug-table"
            , tableFilter = "drug-table-filter"
            , searchFilter = "drug-search"
            , cols = [
                {width: 60, field: "_serial", title: "序号"},
                {width: 170, field: "number", title: "上报编号", event: "detail", style: "color:blue"},
                {field: "title", title: "药品名称"},
                {field: "category", title: "药品类别"},
                // {field: "dosage_form", title: "药品剂型"},
                {field: "risk", title: "风险累及系统-器官"},
                {width: 170, field: "reported_at", title: "上报时间", sort: true},
                {field: "unit", title: "上报单位"},
                {field: "address", title: "所属地区"},
                {field: "phone", title: "联系电话"},
                {field: "remark", title: "备注"},
                // {fixed: 'right', width: 150, align: 'center', toolbar: '#tool'}
            ]
            , table = {
                "id": tableId,
                "elem": "#" + tableId,
                "limit": 8,
                "limits": [10, 20, 50, 100],
                "cols": [cols],
                "method": "post",
                "request": {"pageName": "page", "limitName": "per-page"},
                "url": "/report-ready",
                "page": {"hash": "fenye"},
                "autoSort": false,
                "defaultToolbar": []
            }
            , eventOptions = {
                "detail": {"url": "/report-ready/view", "open": "iframe", "openRefresh": true},
            }
            , events = {}

        pager.render({
            "searchFilter": searchFilter,
            "tableId": tableId,
            "tableFilter": tableFilter,
            "sort": "server",
            "countCache": true,
            "table": table,
            "editor": {
                "method": "get",
                "url": "/sys/menu/update",
                "select": [{"field": "pid", "data": [{"name": "1", "value": "TTT"}]}]
            },
            "eventOptions": eventOptions
        }, events)
    })
</script>
{% endblock %}